$(function(){
	//判断用户名格式
	$("#submit").click(function(){
		var name = $("#name").val();
		var psd = $("#password").val();
		var num = $("#num").val();
		if(name==""){
			layer.open({
				type:0,
				time:1,
				content:'用户名不能为空！',
				skin:'msg',
				shade:'ture',
				anim:'false'
			});
			return false;
		};
		var nameTel = /^1[3|4|5|8][0-9]\d{4,8}$/;
		var nameEmail =  /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
		nameTel.test(name);
		if(!(nameTel.test(name)||nameEmail.test(name))){
			console.log("111")
			layer.open({
				type:0,
				time:1,
				content:'请填写正确格式！',
				skin:'msg',
				shade:'ture',
				anim:'false'
			});
			return false;
		}
		//判断密码是否为空
		if(psd==""){
			layer.open({
				type:0,
				time:1,
				content:'密码不能为空！',
				skin:'msg',
				shade:'ture',
				anim:'false'
			});
			return false;
		};
		//判断密码格式
		var passwordTip =/^[a-zA-Z]\w{5,17}$/;
		if(!passwordTip.test(psd)){
			layer.open({
				type:0,
				time:1,
				content:'密码格式不正确！',
				skin:'msg',
				shade:'ture',
				anim:'false'
			});
			return false;
		};
	});
});